@echo off

set output=MotoCMD_dev.elf

set armdir=c:/arm
set sdkdir=../sdk
set lib_o=../Lib.o
rem  -DDEBUG -DDEBUG_MEMORY -DDEBUG_TIME
rem  -DFTR_L7E
rem  -DAPP_FTR_ERROR_SOUND -DAPP_FTR_FAST -DAPP_FTR_REMOVE_DIR_BY_FW -DAPP_FTR_STACK_AS_COPY_BUFFER -DAPP_FTP_LANG_RUS
set options=-DAPP_FTR_ERROR_SOUND -DAPP_FTR_FAST -DDEBUG

if exist %output% del %output%


set src_input=arch_br.c confirm.c edit.c fb.c input.c output.c
set src_util=cmds.c icons.c lang.c util.c

%armdir%/tcpp -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% main.cpp
%armdir%/tcc -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% %src_input% %src_util%

set tmp_o=main.o arch_br.o confirm.o edit.o fb.o input.o output.o cmds.o icons.o lang.o util.o
set ext_o=../dbg/dbg.o ../classes/class_ini.o ../libs/libc.o ../classes/ccfile.o util/file_list.o

echo =======================================

%armdir%/armlink -reloc -first Lib.o(Lib) -o %output% %tmp_o% %ext_o% %lib_o%




del %tmp_o%

if exist %output% (
	echo ACK: File `%output%` created
) else (
	echo ERR: File `%output%` not created
)
